]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageList: Reduce flexibility of section visibility
authorJulian Sparber <julian@sparber.net>
Thu, 9 May 2024 15:36:34 +0000 (17:36 +0200)
committerJulian Sparber <julian@sparber.net>
Sun, 2 Feb 2025 17:40:14 +0000 (17:40 +0000)
Section visibility has become less complex when moving events
out of the message list. We no longer need different behavior
in different sections, so we can instead control the visibility
of the entire list in a single place.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3429>

js/ui/calendar.js
js/ui/dateMenu.js
js/ui/messageList.js

index 9451d0afc21217cef45b9fd66a8bb0b558e69572..855343165cc11b5706197c363dfd74ab40335be2 100644 (file)
@@ -5,7 +5,6 @@ import GObject from 'gi://GObject';
 import Shell from 'gi://Shell';
 import St from 'gi://St';
 
-import * as Main from './main.js';
 import * as MessageList from './messageList.js';
 import * as PopupMenu from './popupMenu.js';
 import {ensureActorVisibleInScrollView} from '../misc/animationUtils.js';
@@ -881,8 +880,6 @@ class CalendarMessageList extends St.Widget {
 
         this._notificationSection = new MessageList.NotificationSection();
         this._addSection(this._notificationSection);
-
-        Main.sessionMode.connect('updated', this._sync.bind(this));
     }
 
     _addSection(section) {
@@ -899,10 +896,6 @@ class CalendarMessageList extends St.Widget {
 
     _sync() {
         let sections = this._sectionList.get_children();
-        let visible = sections.some(s => s.allowed);
-        this.visible = visible;
-        if (!visible)
-            return;
 
         let empty = sections.every(s => s.empty || !s.visible);
         this._placeholder.visible = empty;
index 103c4d4391b7c4a67143b40c813ea593a19f9c1a..92fff5ecbcb0058141a07ef15f4b197580c2e9b2 100644 (file)
@@ -1000,5 +1000,7 @@ class DateMenuButton extends PanelMenu.Button {
         // but the corresponding app (clocks, weather); however we can consider
         // that display-specific settings, so re-use "allowSettings" here ...
         this._displaysSection.visible = Main.sessionMode.allowSettings;
+
+        this._messageList.visible = Main.sessionMode.hasNotifications && !Main.sessionMode.isGreeter;
     }
 });
index b9456f3f9ece446ff3e88f6b8ddf2fe10c1cb7ec..cf19648d1681ba10b5f2f35c383d0d8ec256e488 100644 (file)
@@ -862,10 +862,6 @@ export const MessageListSection = GObject.registerClass({
         this.emit('message-focused', messageActor);
     }
 
-    get allowed() {
-        return true;
-    }
-
     addMessage(message, animate) {
         this.addMessageAtIndex(message, -1, animate);
     }
@@ -990,10 +986,6 @@ export const MessageListSection = GObject.registerClass({
         }
     }
 
-    _shouldShow() {
-        return !this.empty;
-    }
-
     _sync() {
         let messages = this._messages;
         let empty = messages.length === 0;
@@ -1009,7 +1001,7 @@ export const MessageListSection = GObject.registerClass({
             this.notify('can-clear');
         }
 
-        this.visible = this.allowed && this._shouldShow();
+        this.visible = !this.empty;
     }
 });
 
@@ -1026,11 +1018,6 @@ class NotificationSection extends MessageListSection {
         });
     }
 
-    get allowed() {
-        return Main.sessionMode.hasNotifications &&
-               !Main.sessionMode.isGreeter;
-    }
-
     _sourceAdded(tray, source) {
         source.connectObject(
             'notification-added', this._onNotificationAdded.bind(this),
@@ -1111,8 +1098,4 @@ class MediaSection extends MessageListSection {
 
         this._players.delete(player);
     }
-
-    get allowed() {
-        return !Main.sessionMode.isGreeter;
-    }
 });